var Adv_skd=require("./Adv_skd")

var cc__decorate = __decorate;
Object.defineProperty(exports, "__esModule", {
  value: true
});
var $2pvzChannel = require("pvzChannel");
var $2BundleManager = require("BundleManager");
var $2PlantMgr = require("PlantMgr");
var $2UIManager = require("UIManager");
var $2SceneStage = require("SceneStage");
var $2TaSdk = require("TaSdk");
var cc__decorator = cc._decorator;
var ccp_ccclass = cc__decorator.ccclass;
var ccp_property = cc__decorator.property;
var def_BallPanelUI = /* */function (_cc$Component3) {
  babel_inherits(u, _cc$Component3);
  var _super3 = babel_createSuper(u);
  function u() {
    var _this7;
    babel_classCallCheck(this, u);
    _this7 = _super3.apply(this, arguments);
    _this7.plantAni = null;
    _this7.cost = null;
    _this7.cd = null;
    _this7.attack = null;
    _this7.attackWord = null;
    _this7.desc = null;
    _this7.costLabel = null;
    return _this7;
  }
  babel_createClass(u, [{
    key: "init",
    value: function init(e, t) {
      this.ball = t;
      this.plantID = e;
      var a = $2PlantMgr.default.instance().getPlant(this.plantID);
      this.plantAni.skeletonData = $2BundleManager.default.instance.getBundleRes("Spine", "plant/" + a.dragonName + "/" + a.dragonName, sp.SkeletonData);
      this.plantAni.setAnimation(0, "daiji", true);
      this.cost.string = a.cost[0][1];
      this.cd.string = a.cd[0][1];
      this.attack.string = a.damage[0][1];
      this.costLabel.string = "X" + this.cost.string;
      this.desc.string = "描述： " + a.desc;
      this.attackWord.string = 2 == e || 12 == e ? "生产" : 21 == e || 22 == e ? "防御" : "伤害";
      $2TaSdk.default.instance.AdsExposure($2TaSdk.VideoIndex.BallTry);
    }
  }, {
      key: "start",
      value: function start() {
        Adv_skd.default.instance.hideAllAdv();
        Adv_skd.default.instance.showInterstitialAd();
        Adv_skd.default.instance.showGridAdLeft();

        cc.director.pause();
      }
    }, {
      key: "onClickClose",
    value: function onClickClose() {
            Adv_skd.default.instance.hideAllAdv();
      
      $2UIManager.default.instance.closeUI("BallPanelUI");
      cc.director.resume();
    }
  }, {
    key: "onClickVideo",
    value: function onClickVideo() {
      var _this8 = this;
      $2TaSdk.default.instance.AdsButtonClick($2TaSdk.VideoIndex.BallTry);
      $2pvzChannel.pvzChannel.instance().showVideo({
        sucCall() {
          $2SceneStage.default.instance.goldNums += parseInt(_this8.cost.string);
          _this8.ball.getReward();
          _this8.onClickClose();
        },
        failCall() {},
        endCall() {}
      });
    }
  }]);
  return u;
}(cc.Component);
cc__decorate([ccp_property(sp.Skeleton)], def_BallPanelUI.prototype, "plantAni", undefined);
cc__decorate([ccp_property(cc.Label)], def_BallPanelUI.prototype, "cost", undefined);
cc__decorate([ccp_property(cc.Label)], def_BallPanelUI.prototype, "cd", undefined);
cc__decorate([ccp_property(cc.Label)], def_BallPanelUI.prototype, "attack", undefined);
cc__decorate([ccp_property(cc.Label)], def_BallPanelUI.prototype, "attackWord", undefined);
cc__decorate([ccp_property(cc.Label)], def_BallPanelUI.prototype, "desc", undefined);
cc__decorate([ccp_property(cc.Label)], def_BallPanelUI.prototype, "costLabel", undefined);
def_BallPanelUI = cc__decorate([ccp_ccclass], def_BallPanelUI);
exports.default = def_BallPanelUI;